﻿using System;
using UnityEngine;
using LuaInterface;
using Object = UnityEngine.Object;

public class ResourceManagerWrap
{
	public static void Register(IntPtr L)
	{
		LuaMethod[] regs = new LuaMethod[]
		{
			new LuaMethod("AddSearchPath", AddSearchPath),
			new LuaMethod("GetFilePath", GetFilePath),
			new LuaMethod("IsFileExists", IsFileExists),
			new LuaMethod("LoadBundleConfigFile", LoadBundleConfigFile),
			new LuaMethod("LoadGameObjectFromBundle", LoadGameObjectFromBundle),
			new LuaMethod("New", _CreateResourceManager),
			new LuaMethod("GetClassType", GetClassType),
			new LuaMethod("__eq", Lua_Eq),
		};

		LuaField[] fields = new LuaField[]
		{
		};

		LuaScriptMgr.RegisterLib(L, "ResourceManager", typeof(ResourceManager), regs, fields, typeof(MonoBehaviour));
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int _CreateResourceManager(IntPtr L)
	{
		LuaDLL.luaL_error(L, "ResourceManager class does not have a constructor function");
		return 0;
	}

	static Type classType = typeof(ResourceManager);

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetClassType(IntPtr L)
	{
		LuaScriptMgr.Push(L, classType);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int AddSearchPath(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		ResourceManager obj = (ResourceManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ResourceManager");
		string arg0 = LuaScriptMgr.GetLuaString(L, 2);
		obj.AddSearchPath(arg0);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int GetFilePath(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		ResourceManager obj = (ResourceManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ResourceManager");
		string arg0 = LuaScriptMgr.GetLuaString(L, 2);
		string o = obj.GetFilePath(arg0);
		LuaScriptMgr.Push(L, o);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int IsFileExists(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		ResourceManager obj = (ResourceManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ResourceManager");
		string arg0 = LuaScriptMgr.GetLuaString(L, 2);
		string o = obj.IsFileExists(arg0);
		LuaScriptMgr.Push(L, o);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int LoadBundleConfigFile(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		ResourceManager obj = (ResourceManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ResourceManager");
		string arg0 = LuaScriptMgr.GetLuaString(L, 2);
		obj.LoadBundleConfigFile(arg0);
		return 0;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int LoadGameObjectFromBundle(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		ResourceManager obj = (ResourceManager)LuaScriptMgr.GetUnityObjectSelf(L, 1, "ResourceManager");
		string arg0 = LuaScriptMgr.GetLuaString(L, 2);
		Object o = obj.LoadGameObjectFromBundle(arg0);
		LuaScriptMgr.Push(L, o);
		return 1;
	}

	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	static int Lua_Eq(IntPtr L)
	{
		LuaScriptMgr.CheckArgsCount(L, 2);
		Object arg0 = LuaScriptMgr.GetLuaObject(L, 1) as Object;
		Object arg1 = LuaScriptMgr.GetLuaObject(L, 2) as Object;
		bool o = arg0 == arg1;
		LuaScriptMgr.Push(L, o);
		return 1;
	}
}

